
import 'package:flutter/material.dart';
import 'package:flutterlib/common/net/dao_result.dart';
import 'package:flutterlib/common/net/retrofit/post_api.dart';
import 'package:flutterlib/common/style/quhui_style.dart';
import 'package:flutterlib/common/utils/navigator_utils.dart';
import 'package:flutterlib/model/post/post_bean.dart';
import 'package:flutterlib/pages/post/post_list_widget_page.dart';
import 'package:flutterlib/widgets/bussiness/post/post_list_item.dart';
import 'package:flutterlib/widgets/bussiness/post/post_simple_list_item.dart';

class PostSimpleListWidgetPage extends PostListWidgetPage {
  final int userId;

  PostSimpleListWidgetPage({Key key, this.userId})
      : super(key: key);

  @override
  PostSimpleListWidgetPageState createState() => PostSimpleListWidgetPageState();
}

///页面 KeepAlive ，同时支持 动画Ticker
class PostSimpleListWidgetPageState extends PostListWidgetPageState<PostSimpleListWidgetPage>
    {

  getDataLogic(int page) async {
    print(page);

    var posts = await PostApi.builder().pageByUserQuery(
        page - 1, 20, "createTime,desc", widget.userId
    );
    return new DataResult(posts.content, true);
  }

  Widget renderItem(index, post) {
    //提交
    // var post = pullLoadWidgetControl.dataList[index];
    return PostSimpleListItem(post, onPressed: () {
      NavigatorUtils.goPostDetail(context, post.id);
    });
  }
  @override
  List<Widget> renderHeader(BuildContext context, bool innerBoxIsScrolled) {
    List<Widget> widgets = [];

    return widgets;
  }
}
